package com.xuecheng.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
@Component
public class MediaServiceClientFallbackFactory implements FallbackFactory<MediaServiceClient> {
	
	//使用FallbackFactory可以获取异常信息
	@Override
	public MediaServiceClient create(Throwable throwable) {
		return (filedata, folder, objectName) -> {
			//降级方法
			log.error("调用媒资管理服务上传文件时发生熔断，异常信息:{}", throwable.getMessage());
			return null;
		};
	}
}
